package com.greet.controller.user;

import com.greet.entity.Category;
import com.greet.result.Result;
import com.greet.service.CategoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/user/category")
public class CategoryViewController {
    @Autowired
    private CategoryService categoryService;

    @GetMapping("/list")
    public Result<List<Category>> getByType(Integer type){
        List<Category> categoryList = categoryService.selectByType(type);
        return Result.success(categoryList);
    }
}
